Interactives

Column

Filters

Datatable

Column

Interactive map

Information

Blurb

This example was shown as part of a talk at the Enterprise Applications of the R Language (EARL) conference in London, September 2018.

Crosstalk: Shiny-like without Shiny

Self-service interactive tools have great power to support decisions by policy-makers. Shiny apps are a natural fit for this, but it’s not always easy to share them within the public sector. This is due to issues like a lack of server space, highly sensitive data and users who aren’t R-savvy.

We’ve approached this problem in the UK’s Department for Education by sharing interactive HTML widgets – embeddable JavaScript visualisation libraries – within RMarkdown outputs. Interactivity is, however, limited because selections in one widget don’t impact the data presented in another.

Joe Cheng’s Crosstalk package overcomes this with shared data objects that react to user inputs, altering the content of multiple widgets on the fly. I’ll explain how I used Crosstalk to develop a ‘pseudo-app’ for exploring schools data with the Leaflet (maps), Plotly (charts) and DT (tables) widgets inside the Flexdashboard framework and how I shared it easily with policy-making users as a static HTML file for exploration in the browser.

How to use

Filters

You can:

  • select one or more local authorities from the dropdown menu (remove them with your backspace key)
  • select one or more Ofsted grades using the checkboxes
  • select the phase of education with the checkboxes
  • drag the slider to select a pupil count
  • drag the slider to filter by the percenatge of pupils receiving free school meals

Interactive map

You can:

  • click to grab and drag the map around
  • zoom with the ‘+’ and ‘–’ buttons (top-left) or with your mouse’s scroll wheel
  • click a marker to reveal a popup with information about that school
  • click the button showing a broken square (top-left under the zoom options) to select points on the map using a window that’s draggable (click and hold the grid icon in the upper left) and resizeable (click and drag the white boxes in each corner)

Datatable

You can:

  • filter each column by typing in the boxes under each column header
  • sort the columns (ascending and descending) by clicking on the column header
  • change which columns are visible by clicking the Column visibility button
  • click ‘CSV’ or ‘Excel’ to download the filtered data to a .csv file or a .xlsx
  • see how many entries remain after filtering in the bottom-left, where it says ‘Showing X to Y of Z entries’

Tools

Framework

Widgets

  • Leaflet for the interactive map
  • DT for the interactive table
  • Crosstalk to link the widgets

Icons

Code

The code for this tool is available from github.com/matt-dray/earl18-crosstalk